<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        body {
            perspective: 500px;
        }
        .box {
            position: relative;
            width: 100px;
            height: 100px;
            transform-style: preserve-3d;
            margin: 100px auto;
            transition: all 2s;
        }
        .box:hover {
            transform: rotateY(360deg);
        }
        .box div {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: pink;
        }
        .box div:last-child {
            background-color: skyblue;
            transform: translateZ(-100px);
        }
    </style>
</head>
<body>
    <div class="box">
         <div></div>
         <div></div>
    </div>
</body>
</html>